//
//  Extension.swift
//  HoneyBee
//
//  Created by point on 2018/2/9.
//  Copyright © 2018年 point. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    // 左边导航栏上方按钮
    convenience init(title: String,fontSize :CGFloat = 16,target: AnyObject,action: Selector,isBack: Bool = false) {
        let btn :UIButton = UIButton(type: .custom)
        btn.setTitle(title, for: .normal)
        btn.titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
        btn.setTitleColor(UIColor.white, for: .normal)
        btn.setTitleColor(UIColor(hex: "1296db"), for: .highlighted)
        let imageName = "main_back"
        if isBack {
            btn.setImage(UIImage(named:imageName), for: .normal)
            btn.setImage(UIImage(named:imageName + "_light"), for: .highlighted)
            btn.sizeToFit()
        }
        btn.addTarget(target, action: action, for: .touchUpInside)
        self.init(customView: btn)
    }
    
}
